<template>
  <div class="背景">
    <div class="页眉">
    </div>
    <!--分栏-->
    <el-row :gutter="16" type="flex" justify="center">
      <!--菜单栏-->
      <el-col :span="4">
        <div class="文本框" style="height: 900px;">
          <el-menu  router>
            <el-menu-item index="/CreationCenter" >
              <div class="文本">
                <i class="el-icon-menu"></i>
                首页
              </div>
            </el-menu-item>
            <el-submenu index="001">
              <template slot="title">
                <div class="文本">
                  <i class="el-icon-edit-outline"></i>
                  创作
                </div>
              </template>
              <el-menu-item index="/CreationCenter/SendArticle">发布文章</el-menu-item>
              <el-menu-item index="/CreationCenter/SendVideo">发布视频</el-menu-item>
              <el-menu-item index="/CreationCenter/SendReport">发布研报</el-menu-item>
              <el-menu-item index="/CreationCenter/SendTinyArticle">发布富微条</el-menu-item>
            </el-submenu>
            <el-menu-item index="/CreationCenter/ManageArticle">
              <div class="文本">
                <i class="el-icon-reading"></i>
                作品管理
              </div>
            </el-menu-item>
            <el-submenu index="002">
              <template slot="title">
                <div class="文本">
                  <i class="el-icon-view"></i>
                  互动管理
                </div>
              </template>
              <el-menu-item index="/CreationCenter/ManageFollow">关注管理</el-menu-item>
              <el-menu-item index="/CreationCenter/ManageComment">评论管理</el-menu-item>
              <el-menu-item index="/CreationCenter/ManagePM">私信管理</el-menu-item>
            </el-submenu>
            <el-submenu index="003">
              <template slot="title">
                <div class="文本">
                  <i class="el-icon-document"></i>
                  数据分析
                </div>
              </template>
              <el-menu-item index="/CreationCenter/DataArticle">作品数据</el-menu-item>
              <el-menu-item index="/CreationCenter/DataFans">粉丝数据</el-menu-item>
              <el-menu-item index="/CreationCenter/DataProfit">收益数据</el-menu-item>
            </el-submenu>
            <el-menu-item index="/CreationCenter/Option">
              <div class="文本">
                <i class="el-icon-setting"></i>
                设置
              </div>
            </el-menu-item>
          </el-menu>
        </div>
      </el-col>
      <!--正文栏-->
      <el-col :span="14">
        <div class="文本框">
          <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/CreationCenter' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>发布文章</el-breadcrumb-item>
          </el-breadcrumb>
          <br/>
          <el-input
              type="text"
              placeholder="标题"
              border="0"
              v-model="uploadArticleArgs.articleTitle"
              maxlength="30"
              show-word-limit>
          </el-input>
          <el-divider></el-divider>
          <div style="height:600px;">
            <quill-editor ref="myTextEditor" v-model="uploadArticleArgs.articleContent" :options="editorOption" style="height:500px;"></quill-editor>
          </div>
          <div>
            <span>
            创作类型：
          </span>
            <el-radio-group v-model="radio">
              <el-radio :label="1">原创</el-radio>
              <el-radio :label="2">转载</el-radio>
            </el-radio-group>
          </div>
          <br/>
          <div>
            <span>
            文章类别：
          </span>
            <el-radio-group v-model="radio_2">
              <el-radio :label="3">宏观</el-radio>
              <el-radio :label="4">股票</el-radio>
              <el-radio :label="5">理财</el-radio>
              <el-radio :label="6">基金</el-radio>
              <el-radio :label="7">保险</el-radio>
              <el-radio :label="8">地产</el-radio>
              <el-radio :label="9">其他</el-radio>
            </el-radio-group>
          </div>
          <br/>
          <div class="居中">
            <el-button>预览</el-button>
            <el-button type="primary" @click="uploadArticle">发布</el-button>
          </div>
        </div>
      </el-col>
    </el-row>

    <div class="页眉">
    </div>
  </div>
</template>

<style>
.el-input__inner {
  border-radius: 0px;
  font-size: 16px;
}

</style>


<script>
export default {
  data() {
    return {
      textarea: '',
      radio: 0,
      radio_2: 0,
      editorOption: {
        placeholder: ''
      },
      uploadArticleArgs: {
        idUser: window.sessionStorage.getItem("idUser"),
        articleTitle:"",
        articleAbstract:"",
        articleUploadUrl:"222.11.1123.1",
        articleUpdateUrl:"222.11.1123.1",
        articleAuthority:"0",
        articleType:"嘿嘿",
        articleStatus:"1",
        articleContent:"",
        articleCover:""
      }
    }
  },
  methods: {
    async uploadArticle() {
      console.log(this.uploadArticleArgs.articleContent)
      const {data: res} = await this.$http.post("http://39.102.77.65:8081/article/upload", this.uploadArticleArgs);
      this.$message({
        message: '发布成功！',
        type: 'success'
      });
      this.$router.push('/CreationCenter');
      console.log(res)
    }


  }
}
</script>